SCRIPT_ABSOLUTE_DIR=$(dirname "$0")

RELEASE_DIR_RELATIVE_PATH="bin/Release"
NUGET_SECRETS_FILE_RELATIVE_PATH="Secrets/nuget-secrets.sh"

RELEASE_DIR_ABSOLUTE_PATH="${SCRIPT_ABSOLUTE_DIR}/${RELEASE_DIR_RELATIVE_PATH}"
NUGET_SECRETS_FILE_ABSOLUTE_PATH="${SCRIPT_ABSOLUTE_DIR}/${NUGET_SECRETS_FILE_RELATIVE_PATH}"

. ${NUGET_SECRETS_FILE_ABSOLUTE_PATH}

cd $RELEASE_DIR_ABSOLUTE_PATH

LATEST_NUGET_PACKAGE_FILE=$(ls -1 *.nupkg | tail -n 1)

echo $LATEST_NUGET_PACKAGE_FILE

dotnet nuget push $LATEST_NUGET_PACKAGE_FILE --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json